var app = getApp();

Page({
    data: {},
    onLoad: function(t) {
        var e = this;
        app.setNavigationBarColor(this), app.getSystem(this), app.getUrl(this), console.log(t), 
        e.setData({
            options: t
        }), app.util.request({
            url: "entry/wxapp/PjDetails",
            cachetime: "0",
            data: {
                ticket_id: t.id
            },
            success: function(t) {
                for (var a in console.log(t), t.data.pjdetails.end_time = app.ormatDate(t.data.pjdetails.end_time).slice(0, 16), 
                t.data.pjdetails.start_time = app.ormatDate(t.data.pjdetails.start_time).slice(0, 16), 
                t.data.pjdetails.time = app.ormatDate(t.data.pjdetails.time).slice(0, 16), t.data.bminfo) "上传图片" == t.data.bminfo[a].name && (console.log(t.data.bminfo[a].value.split(",")), 
                e.setData({
                    img_list: t.data.bminfo[a].value.split(",")
                }));
                e.setData({
                    details: t.data.pjdetails,
                    bminfo: t.data.bminfo
                });
            }
        });
    },
    refuse: function(t) {
        var a = this, e = (a.data.options.state, a.data.options.id), i = a.data.details.money;
        console.log(i), wx.showModal({
            title: "",
            content: "是否拒绝该用户报名",
            success: function(t) {
                t.confirm && (i <= 0 ? app.util.request({
                    url: "entry/wxapp/ApplyRefund",
                    data: {
                        state: 6,
                        ticket_id: e
                    },
                    success: function(t) {
                        console.log(t), 1 == t.data && (wx.showToast({
                            title: "操作成功",
                            duration: 2e3
                        }), setTimeout(function() {
                            wx.navigateBack({
                                delta: 1
                            });
                        }, 2e3));
                    }
                }) : app.util.request({
                    url: "entry/wxapp/Refund",
                    data: {
                        state: 6,
                        ticket_id: e
                    },
                    success: function(t) {
                        console.log(t), 1 == t.data && (wx.showToast({
                            title: "操作成功",
                            duration: 2e3
                        }), setTimeout(function() {
                            wx.navigateBack({
                                delta: 1
                            });
                        }, 2e3));
                    }
                }));
            }
        });
    },
    agree_ticket: function(t) {
        this.data.options.state;
        var a = this.data.options.id;
        wx.showModal({
            title: "",
            content: "是否通过退票",
            success: function(t) {
                t.confirm && app.util.request({
                    url: "entry/wxapp/Refund",
                    data: {
                        ticket_id: a,
                        state:5
                    },
                    success: function(t) {
                        console.log(t), 1 == t.data && (wx.showToast({
                            title: "操作成功",
                            duration: 2e3
                        }), setTimeout(function() {
                            wx.navigateBack({
                                delta: 1
                            });
                        }, 2e3));
                    }
                });
            }
        });
    },
    refuse_ticket: function(t) {
        var a = this.data.details;
        wx.showModal({
            title: "",
            content: "是否通过退票",
            success: function(t) {
                t.confirm && app.util.request({
                    url: "entry/wxapp/ApplyRefund",
                    data: {
                        state: 2,
                        ticket_id: a.ticket_id
                    },
                    success: function(t) {
                        console.log(t), 1 == t.data && (wx.showToast({
                            title: "操作成功",
                            duration: 2e3
                        }), setTimeout(function() {
                            wx.navigateBack({
                                delta: 1
                            });
                        }, 2e3));
                    }
                });
            }
        });
    },
    agree: function(t) {
        var a = this.data.options.state, e = this.data.options.id;
        1 == a && app.util.request({
            url: "entry/wxapp/UpdPj",
            data: {
                state: 2,
                ticket_id: e
            },
            success: function(t) {
                console.log(t), 1 == t.data && (wx.showToast({
                    title: "操作成功",
                    duration: 2e3
                }), setTimeout(function() {
                    wx.navigateBack({
                        delta: 1
                    });
                }, 2e3));
            }
        });
    },
    phone: function(t) {
        var a = this.data.bminfo;
        for (var e in a) console.log(a[e]), 0 == a[e].name.indexOf("手机") && wx.makePhoneCall({
            phoneNumber: a[e].value
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {}
});